{extend name="public/common"} {block name="body"}
<title>基本设置</title>
</head>
<body>
  <nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    系统管理
    <span class="c-gray en">&gt;</span>
    财务设置
    <span class="c-gray en">&gt;</span>
   充值支付方案
   <span class="c-gray en">&gt;</span>
   线上支付方案
    <span class="c-gray en">&gt;</span>
   	查看账户
    <a class="btn btn-success radius r"
      style="line-height: 1.6em; margin-top: 3px"
      href="javascript:location.replace(location.href);" title="刷新">
      <i class="Hui-iconfont">&#xe68f;</i>
    </a>
  </nav>

  
  <div class="page-container  dataTables_wrapper">
      <div id="tab-system" class="HuiTab">
        <div class="tabCon">
          <div class="mt-20">
            <table
              class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
              <thead>
                <tr class="text-c">
                <th>账户序号</th>
                <th>账户名称</th>
                <th>所属支付</th>
                <th>账户类型</th>
                <th>标识</th>
                <th>禁用状态</th>
                <th>操作</th>
                </tr>
              </thead>
              <tbody>
              {volist name="query" id="item"}
                <tr class="text-c">
                	<td>{$item.id}</td>
                	<td>{$item.name}</td>
                  <td>
                    <select onchange="checkMethod(this,{$item['id']},2)">
                      <option value="0">关闭</option>
                      {foreach $method as $key=>$val}
                      <option value="{$key}" {if( $key==$item['method_id'] )} selected {/if}>{$val}</option>
                      {/foreach}
                    </select>

                  </td>
                	<td>{$item.type}</td>
                	<td>{$item.label}</td>
                	<td>
                		<input type="radio" value="lock" name="lock_{$item.id}" {if($item.lock==1)}checked="checked"{/if} onchange="updateLock(this.value,{$item.id},1)" />禁用
                		&nbsp;&nbsp;&nbsp;&nbsp;
                		<input type="radio" value="lock" name="lock_{$item.id}" {if($item.lock==0)}checked="checked" }{/if} onchange="updateLock(this.value,{$item.id},0)" />正常
                	</td>
                	<td>
                		<a href="javascript:code_list('二维码列表','{:url(\'Paysetting/codeList\')}?id={$item.id}');">查看二维码</a>&nbsp;&nbsp;|
                		<a  href="javascript:code_list('二维码列表','{:url(\'Paysetting/addCode\')}?id={$item.id}');">添加收款二维码</a>
                	</td>
                </tr>
                {/volist}
              </tbody>
            </table>
          </div>
        </div>
      </div>
      <div class="dataTables_paginate paging_simple_numbers" style="width:100%;">
            <span style="float:right;margin-left:-2px;">总共{$query->lastPage()}页  当前第{$query->currentPage()}页 ，共{$query->total()}条</span>
            <div style="float:left;">{$query->render()}</div>
    </div>
  </div>
{/block}

{block name="js"}
  <script type="text/javascript" src="__SYSMET__/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
  <script type="text/javascript">
    $(function() {
      $('.skin-minimal input').iCheck({
        checkboxClass : 'icheckbox-blue',
        radioClass : 'iradio-blue',
        increaseArea : '20%'
      });
      $("#tab-system").Huitab({
        index : 0
      });
    });
    
</script>
<script>
function updateLock(name,id,value) {
	$.ajax({
        type : "post",
        url : "{:url('paysetting/updateLock')}",
        data : {"name":name,"id":id,"value":value},
        success: function (data) {
			console.log(data);
        }
    });
}

function code_list(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		area: ['95%', '95%'],
		content: url
	});
}
function checkMethod(obj,id,type){
  var select = $(obj).find("option:selected").val();
  $.ajax({
    type : "post",
    url : "{:url('paysetting/checkMethod')}",
    data : {"id":id,"value":select,"type":type},
    success: function (data) {
      data = JSON.parse(data);
      var icon = 5;
      if( 1==parseInt(data.status) ){
        icon = 1;
      }
      layer.msg(data.msg, {icon: icon});
    }
  });
}
</script>
{/block}
